﻿using MODEL;
using SysHelper;
using SysHelper.Attributes;
using System;
using System.Collections.Generic;
using System.Data.Objects;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;

namespace SysController.Order
{
    [SkipPemission]
    public class OrdersController : Controller
    { 
        public ActionResult Index()
        {
            return View();
        }

        public JsonResult GetOrder(OrderModel model)
        {
          List<OrderModel> list=  OperateContext.CurrentContext.BllSession.SqlQuery<OrderModel>(@"SELECT A.SiteId,A.AccountInfoId, A.AmazonOrderId,B.OrderItemId,A.CurrencyCode,A.Amount,
B.ASIN,B.SellerSKU,B.QuantityShipped,B.ItemPriceAmount,A.CreateTime
 FROM [AmazonMWS].con.AmazonOrdersTotal A
LEFT JOIN [AmazonMWS].[con].[AmazonOrdersDetails]B ON A.AmazonOrderId=B.AmazonOrderId
AND A.SiteId=B.SiteId AND A.AccountInfoId=B.AccountInfoId ORDER BY A.CreateTime,A.AccountInfoId ");
          return Json(list, JsonRequestBehavior.AllowGet);
        }


    }
}
